import request from '../utils/request';
const url = 'http://localhost:8080/coach';

export interface coachItemData 
{
    coachId: number,
    coachName: string,
    coachCar: string,
    coachSex: string,
    coachAge: number,
    coachIdentityId: string,
    coachPhone: string
}

export const getCoachBySexOrAge = (sex: string, age1: number, age2: number) => {
    return request({
        url: url+'/getCoachBySexOrAge',
        method: 'post',
        params: { sex, age1, age2 }
    });
};
export const getAllCoach = () => {
    return request({
        url: url+'/getAllCoach',
        method: 'get',
    });
};

export const updateCoach = (coach : coachItemData) => {
    return request({
        url: url+`/updateCoach`,
        method: 'post',
        data : coach,
    });
};

export const filterCoach = (coach : coachItemData) => {
    return request({
        url: url+`/filterCoach`,
        method: 'post',
        data : coach,
    });
};

export const addCoach = (coach : coachItemData) => {
    return request({
        url: url+`/addCoach`,
        method: 'post',
        data : coach,
    });
};

export const deleteCoach = (coachId : string) => {
    return request({
        url: url+`/deleteCoach/`+coachId,
        method: 'delete',
    });
};
